@@ -7,4 +7,17 @@ class User < ActiveRecord::Base |
||
7 | 7 |
has_many :mission_agent_invites |
8 | 8 |
has_many :missions |
9 | 9 |
has_many :validated_bys |
10 |
+ |
|
11 |
+ def completed_missions_count |
|
12 |
+ missions_count = self.mission_agent_invites.where(:status => 'Completed').length |
|
13 |
+ return missions_count |
|
14 |
+ end |
|
15 |
+ |
|
16 |
+ def mission_list |
|
17 |
+ missions = self.mission_agent_invites.where(:status => 'Completed') |
|
18 |
+ missions += self.mission_agent_invites.where(:status => 'Accepted') |
|
19 |
+ missions += self.mission_agent_invites.where(:status => 'Failed') |
|
20 |
+ return missions |
|
21 |
+ end |
|
22 |
+ |
|
10 | 23 |
end |
@@ -1,7 +1,25 @@ |
||
1 |
-<h1> |
|
1 |
+<h1 class="page-header"> |
|
2 | 2 |
<% if @user.username != nil %> |
3 |
- <%= @user.username %> |
|
3 |
+ Agent <%= @user.username %> Profile |
|
4 | 4 |
<% else %> |
5 |
- <%= @user.email %> |
|
5 |
+ Agent <%= @user.email %> Profile |
|
6 | 6 |
<% end %> |
7 | 7 |
</h1> |
8 |
+ |
|
9 |
+<p><strong>Registration Date: </strong><%= @user.created_at%></p> |
|
10 |
+<p><strong>Missions Completed: </strong><%= @user.completed_missions_count %> |
|
11 |
+ |
|
12 |
+<h3>Mission List</h3> |
|
13 |
+<table class="table table-hover"> |
|
14 |
+ <% @user.mission_list.each do |invite| %> |
|
15 |
+ <tr> |
|
16 |
+ <td ><h4><%= invite.mission_agent.mission.title %></h4></td> |
|
17 |
+ <td class="span4" style="padding-top: 16px;"> |
|
18 |
+ <%= render '/missions/mission_agent_invite_status', :invite => invite, :margin => false %> |
|
19 |
+ </td> |
|
20 |
+ <td class="span3" style="padding-top: 16px;"> |
|
21 |
+ <%= render '/missions/mission_status', :mission => invite.mission_agent.mission, :big => false, :margin => false %> |
|
22 |
+ </td> |
|
23 |
+ </tr> |
|
24 |
+ <% end %> |
|
25 |
+</table> |
@@ -0,0 +1,14 @@ |
||
1 |
+<% if invite.status == 'Accepted' %> |
|
2 |
+ <% @status_label = 'label-success'%> |
|
3 |
+<% elsif invite.status == 'Failed' %> |
|
4 |
+ <% @status_label = 'label-important'%> |
|
5 |
+<% elsif invite.status == 'Completed' %> |
|
6 |
+ <% @status_label = 'label-success'%> |
|
7 |
+<% else%> |
|
8 |
+ <% @status_label = 'label-default'%> |
|
9 |
+<% end %> |
|
10 |
+ |
|
11 |
+<strong>Agent Objective Status:</strong> |
|
12 |
+<span class="label <%= @status_label %>" style="<% if margin == true %> margin-top: 8px; margin-right: 10px<% end %>"> |
|
13 |
+ <%= invite.status %> |
|
14 |
+</span> |
@@ -13,7 +13,8 @@ |
||
13 | 13 |
</h4> |
14 | 14 |
</span> |
15 | 15 |
<% else %> |
16 |
- <span class="label <%= @status_label %> pull-right" style="margin-top: 5px;"> |
|
16 |
+ <% if margin == false %><strong>Mission Status:</strong> <% end %> |
|
17 |
+ <span class="label <%= @status_label %> <% if margin == true %>pull-right<% end %>" style="<% if margin == true %>margin-top: 5px;<% end %>"> |
|
17 | 18 |
<%= mission.status %> |
18 | 19 |
</span> |
19 | 20 |
<% end%> |
@@ -27,7 +27,7 @@ |
||
27 | 27 |
<li class="span4"> |
28 | 28 |
<div class="thumbnail mission_thumb" > |
29 | 29 |
<small>Mission Details</small> |
30 |
- <h3><%= truncate(invite.mission_agent.mission.title, :length => 23) %> <%= render 'mission_status', :mission => invite.mission_agent.mission, :big => false %></h3> |
|
30 |
+ <h3><%= truncate(invite.mission_agent.mission.title, :length => 23) %> <%= render 'mission_status', :mission => invite.mission_agent.mission, :big => false, :margin => true %></h3> |
|
31 | 31 |
<h5 >Steps Completed: <%= render 'mission_agent_steps_count', :invite => invite %></h5> |
32 | 32 |
<p style= "padding: 5px; height: 50px;"><%= invite.mission_agent.mission.description %></p> |
33 | 33 |
<%= link_to 'View Mission Details', mission_path(invite.mission_agent.mission), :class => "btn btn-small btn-block btn-default" %> |
@@ -42,7 +42,7 @@ |
||
42 | 42 |
<li class="span4"> |
43 | 43 |
<div class="thumbnail mission_thumb"> |
44 | 44 |
<small>Mission Control</small> |
45 |
- <h3><%= truncate(mission.title, :length => 21) %> <%= render 'mission_alert_badge', :mission => mission %> <%= render 'mission_status', :mission => mission, :big => false %></h3> |
|
45 |
+ <h3><%= truncate(mission.title, :length => 21) %> <%= render 'mission_alert_badge', :mission => mission %> <%= render 'mission_status', :mission => mission, :big => false, :margin => true %></h3> |
|
46 | 46 |
<h5 >Agents: <%= mission.mission_agents.length %></h5> |
47 | 47 |
<p style= "padding: 5px; height: 50px;"><%= mission.description %></p> |
48 | 48 |
<% @owner_agent = false %> |